#include <iostream>
using namespace std;

int dp_function(int m){
    int* sovles = new int[m];
    //初始化1-3阶的走法总数
    sovles[0] = 1;
    sovles[1] = 2;
    sovles[2] = 4;
    if(m >= 3)
        for(int i = 3;i < m;i++)
            sovles[i] = sovles[i-1]+sovles[i-2]+sovles[i-3];
    return sovles[m-1];
}

int main(){
    int m;
    cout << "输入楼梯级数:";
    cin >> m;
    int result = dp_function(m);
    cout << result << endl;
    return 1;
}